package cn.lanqiao.filter;

import javax.servlet.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebFilter(urlPatterns="/*",filterName = "CharSetFilter")
public class CharSetFilter implements Filter {
    public void init(FilterConfig config) throws ServletException {
    }

    public void destroy() {
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
        //前半部分代码，处理进入servlet之前执行的操作
        System.out.println("filter - before");
        chain.doFilter(request, response);
        //后半部分代码，完成servlet只有执行的操作
        System.out.println("filter - after");
    }
}
